#pragma once
#include "expr.h"

class ExprUnary:
	public Expr
{
public:

	ExprUnary(Expr *unary)
	{
		this->unary=unary;
	}

	~ExprUnary(void)
	{
	}
	void setUnary(Expr *unary){
		this->unary=unary;
	}

	Expr* getUnary(){
		return this->unary;
	}
	void setis(int tokentype){
		TokenType tt;
		is_ = tt.returntokenstring(tokentype);

	}

	virtual string is(){
		return is_;
	}
	virtual tipo_ts * validarSemantica(tabla_simbolos *tabla_de_tipo,tabla_simbolos *tabla_de_varaible){
		tipo_ts *tts = this->getUnary()->validarSemantica(tabla_de_tipo,tabla_de_varaible);
		if(tts->is().compare("BOOLEANO")==0){
			return tts;
		}else{
			stringstream out;
			out<<"Se esperaba tipo Booleano"<<endl;
			throw exception(out.str().c_str());			
		}

	}

private:

	Expr *unary;
	string is_;
};

